<%@page import="jdk.nashorn.internal.ir.RuntimeNode.Request"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.Database.*"%>
<%@ page import="java.sql.*"%>
<%
    request.setCharacterEncoding("utf-8");
    String name = request.getParameter("name");
    String pro = request.getParameter("pro");
    //String sql = "insert into personinfo(name , birthProvince) values('"+name+"','"+pro+"')";
    String sql = "insert into personinfo(name,birthProvince) values (?,?)";
    conDB db = new conDB();
    db.connectDB();
    //Statement state = db.getConnection().createStatement();
    //int flag = state.executeUpdate(sql);
    PreparedStatement state = db.getConnection().prepareStatement(sql);
    state.setString(1, name);
    state.setString(2, pro);
    int flag = state.executeUpdate();
    if(flag != 0)
    {
    	 out.println("<script>alert('插入成功！');history.go(-1);</script>");
    }
    else
    {
    	 out.println("<script>alert('插入失败！');history.go(-1);</script>");
    }
    state.close();
   
%>